import Vue from 'vue'
import VueRouter from 'vue-router'
import Class from '@/views/home/class/Class.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/Login',
    component: () => import('../views/login/Login.vue')
  },
  {
    path: '/Registry',
    component: () => import('../views/registry/Registry.vue')
  },
  {
    path: '/home',
    component: () => import('../views/home/Index.vue'),
    children: [
      {
        path: '/home/shou',
        component: () => import('../views/home/shou/Shou.vue'),
      },
      {
        path: '/home/shop',
        component: () => import('../views/home/shop/Shop.vue'),
      },
      {
        path: '/home/order',
        component: () => import('../views/home/order/Order.vue'),
      },
      {
        path: "/home",
        redirect: '/home/shou',  // 重定向:重新指向其它path,会改变网址
      }
    ]
  },
  {
    path: "/",
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
// router.addRoute({
//   path: '/class',
//   name: 'class',
//   component: Class
// })
export default router
